#include <stdio.h>
#include <math.h>

int main(void) {
	int N;
	int sum = 0;
	scanf("%d", &N);
	int m = 0;
	while (N) {
		m = m + N % 10;
		N = N / 10;
		if (N > 0 && N < 10)
			printf("%d ", N);
	}

	printf("%d", m);
}